from django import forms
from captcha.fields import CaptchaField

from mini_pra_api.models import UserInfo


class LoginForm(forms.Form):
    username = forms.CharField(max_length=150)
    password = forms.CharField(widget=forms.PasswordInput)
    captcha = CaptchaField()

class CaptchaForm(forms.Form):
    captcha = CaptchaField()


class UserInfoUpdateForm(forms.ModelForm):
    class Meta:
        model = UserInfo
        fields = ['avatar', 'nickname', 'profile', 'phone', 'email']

    gender = forms.ChoiceField(choices=[('male', '男'), ('female', '女'),('unkonwn','未知')], required=False)
    birthday = forms.DateField(required=False, input_formats=['%Y-%m-%d'])
